package com.carkeeper.service;

import com.carkeeper.dto.ClassPropertiesDTO;
import com.carkeeper.service.serviceFallback.*;
import com.carkeeper.dto.CompTypeDTO;
import com.carkeeper.vo.Pager;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(value = "carkeeper-shop",fallbackFactory = CompTypeFallbackFactory.class)
public interface CompTypeFeign {
    /*
     * 根据id获取二级分类详情
     */
    @GetMapping("/api/classProperties/{id}")
    ClassPropertiesDTO getClassPropertiesById(@PathVariable("id") Long id) ;
    /*
     * 获取二级分类分页详情
     */
    @GetMapping("/api/classProperties")
    Pager<ClassPropertiesDTO> getClassPropertiesByPage(
            @RequestParam(value = "page",defaultValue = "1") Integer page,
            @RequestParam(value = "pagesize",defaultValue = "5") Integer pagesize,
            @RequestParam(value = "classId",required = false) Integer classId);
    /*
     * 获取配件分类详情
     */
    @GetMapping("/api/componentType/{id}")
    CompTypeDTO queryCompTypeById(@PathVariable("id") Long id);


    /*
     * 获取配件分类分页数据
     */
    @GetMapping("/api/componentType")
    Pager<CompTypeDTO> getFirstCompTypeByPage(
            @RequestParam(value = "page",defaultValue = "1") Long page,
            @RequestParam(value = "pagesize",defaultValue = "5")Long pagesize,
            @RequestParam(value = "parentId",required = false)Integer parentId,
            @RequestParam(value = "name",required = false)String name,
            @RequestParam(value = "code",required = false)Integer code) ;
}
